package com.yu.crm.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yu.crm.domain.pojo.Ticketinfo;
import com.yu.crm.service.impl.TicketinfoService;
import com.yu.crm.utils.TicketUtil;
import com.yxzz.common.helper.valid.ValidatorHelpers;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zds
 * @since 2021-03-15
 */
@RestController
@RequestMapping("/ticketinfo")
public class TicketinfoController {

    @Autowired
    private TicketinfoService ticketinfoService;

    @ApiOperation("根据id删除车站")
    @DeleteMapping("/del")
    public void del(){
        ticketinfoService.deleteByTime();
    }

    @ApiOperation(value = "通过身份证号查询购票时间")
    @PostMapping(value = "/selectTicket")
    public Integer selectTicket(String identityId,Integer type,String deviceId){
        ValidatorHelpers.notEmpty(identityId, "编号不能为空");
        ValidatorHelpers.notEmpty(type, "编号类型不能为空");
        ValidatorHelpers.notEmpty(deviceId, "设备编号不能为空");
        return ticketinfoService.selectTicket(identityId, type, deviceId);
    }
}

